package com.cl.utils;

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;

public class ServiceUtils {
	public static boolean isRuningServer(Context context, String serviceName) {
		ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
		 List<RunningServiceInfo> services = am.getRunningServices(100);
		 for(RunningServiceInfo service : services) {
			 String name = service.service.getClassName();
			 if(serviceName.equals(name)) {
				 return true;
			 }
		 }
		 return false;
	}
}
